From a2a03743cc9cd45282e5781c709233af563fd73b Mon Sep 17 00:00:00 2001 From: Christian Korber Date: Mon, 19 May 2025 13:00:22 +0200 Subject: [PATCH] luci-app-snmpd: require 8 character password Test for required length of passphrases according to net-snmp Signed-off-by: Christian Korber --- .../htdocs/luci-static/resources/view/snmpd/snmpd.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js b/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js index a2b5300a8f..6e2e1cad1a 100644 --- a/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js +++ b/applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js @@ -27,6 +27,13 @@ return L.view.extend({ this.snmp_version = null; }, + testPassLength: function(section_id, value) { + if (value.length < 8) + return _('Password must be at least 8 characters'); + + return true; + }, + populateSystemSettings: function(tab, s) { let g, go, o; @@ -320,6 +327,7 @@ return L.view.extend({ go.rmempty = true; go.modalonly = true; go.optional = false; + go.validate = this.testPassLength; go.depends({'auth_type': '', '!reverse': true}); // SNMPv3 privacy/encryption type @@ -338,6 +346,7 @@ return L.view.extend({ go.rmempty = true; go.modalonly = true; go.optional = false; + go.validate = this.testPassLength; go.depends({'privacy_type': '', '!reverse': true}); go = g.option(form.ListValue, 'RestrictOID', -- 2.30.2